package com.wander.patterns.create.factory.simplefactory;

import com.wander.patterns.create.factory.factorymethod.AudiCar;
import com.wander.patterns.create.factory.factorymethod.BydCar;
import com.wander.patterns.create.factory.factorymethod.ICar;

/**
 * @description: 简单(静态)工厂实例
 * @author: zhuyong
 * @create: 2019-09-04 17:52
 **/
public class Client {
    public static void main(String[] args) {
        //没有引入工厂之前 对应客户端而言 需要知道哪些车  哪些接口
        ICar car1 = new AudiCar();
        ICar car2 = new BydCar();
        car1.produce();
        car2.produce();

        CarFactory carFactory = new CarFactory();
        //对应客户端是简单了,但是也存在一个问题  carFactory 新增一个品牌的车 我又得改carFactory
        ICar car = carFactory.produce("奥迪");
        car.produce();


    }
}
